<%= form_for @metric, :html => {:class => "main_form"} do |f| %>
	<% if @metric.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@metric.errors.count, "error") %> prohibited this metric from being saved:</h2>

      <ul>
      <% @metric.errors.full_messages.each do |msg| %>
        <li><%= msg %></li>
      <% end %>
      </ul>
    </div>
  <% end %>


	<% unless @metric.new_record? %>
		<div class="field">
			<%= f.check_box :archived %>
			<%= f.label :archived %>
		</div>
	<% end %>

	<div class="field">
		<%= f.label :name %>
		<%= f.text_field :name, :size => 50 %>
	</div>
	
	<div class="field">
		<%= f.label :collection_type %>
		<%= f.select :collection_type, {"event_counter" 	=> {:label => "Simple Event Counter"},
																		"model_counter" 	=> {:label => "Simple Model Counter"},
																		"custom"					=> {:label => "Custom"},
																		"conversion_rate"	=> {:label => "Conversion Rate", :disabled => true}} %>
	</div>
	
	
	<div id="active_options_holder">
		<% if @metric.event_counter_type? %>
			<%= render :partial => "options_for_event_counter", :locals => {:f => f} %>
		<% elsif @metric.model_counter_type? %>
			<%= render :partial => "options_for_model_counter", :locals => {:f => f} %>
		<% elsif @metric.custom_type?%>
			<%= render :partial => "options_for_custom", :locals => {:f => f} %>
		<% end %>
	</div>
	
	
	<hr/>

	<div class="field">
		<%= f.submit %>
	</div>
<% end %>

<div id="unused_form_elements">
	<%= form_for @metric do |f| %>
		<% if !@metric.event_counter_type? %>
			<%= render :partial => "options_for_event_counter", :locals => {:f => f} %>
		<% end %>
		<% if !@metric.model_counter_type? %>
			<%= render :partial => "options_for_model_counter", :locals => {:f => f} %>
		<% end %>
		<% if !@metric.custom_type?%>
			<%= render :partial => "options_for_custom", :locals => {:f => f} %>
		<% end %>
	<% end %>
</div>